package vistasOficinaVenta;

import java.awt.BorderLayout;
import java.awt.GraphicsEnvironment;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JDesktopPane;
import javax.swing.JLayeredPane;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.WindowConstants;

import beans.UsuarioBean;

/**
 * This code was edited or generated using CloudGarden's Jigloo SWT/Swing GUI
 * Builder, which is free for non-commercial use. If Jigloo is being used
 * commercially (ie, by a corporation, company or business for any purpose
 * whatever) then you should purchase a license for each developer using Jigloo.
 * Please visit www.cloudgarden.com for details. Use of Jigloo implies
 * acceptance of these licensing terms. A COMMERCIAL LICENSE HAS NOT BEEN
 * PURCHASED FOR THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED LEGALLY FOR
 * ANY CORPORATE OR COMMERCIAL PURPOSE.
 */
public class MenuPrincipal extends javax.swing.JFrame {

	{
		// Set Look & Feel
		try {
			javax.swing.UIManager
					.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private static final long serialVersionUID = 1L;
	private JDesktopPane jDesktopPane1;
	private JMenuBar jMenuBar1;
	private JMenu jMenu3;
	private JMenu jMenuCliente;
	private JButton btnSalir;
	private JMenuItem jMenuItemModificacion;
	private JMenuItem jMenuItemBaja;
	private JMenuItem jMenuItemAlta;
	private JMenu jMenu1;
	private UsuarioBean usuarioBean;

	public MenuPrincipal(UsuarioBean usuarioBean) {
		super();
		this.usuarioBean = usuarioBean;
		initGUI();
	}

	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			BorderLayout thisLayout = new BorderLayout();
			getContentPane().setLayout(thisLayout);
			Rectangle maxBounds = GraphicsEnvironment
					.getLocalGraphicsEnvironment().getMaximumWindowBounds();
			this.setSize(maxBounds.width, maxBounds.height);
			this.setTitle("Menu");
			this.setSize(205, 171);
			// this.setSize(256, 100);
			{
				jDesktopPane1 = new JDesktopPane();
				getContentPane().add(jDesktopPane1, BorderLayout.CENTER);
				jDesktopPane1.setPreferredSize(new java.awt.Dimension(287, 112));
				{
					btnSalir = new JButton();
					jDesktopPane1.add(btnSalir, JLayeredPane.DEFAULT_LAYER);
					btnSalir.setText("Salir");
					int x = (int) maxBounds.getCenterX();
					int y = (int) maxBounds.getMaxY() - 100;
					btnSalir.setBounds(x, y, 69, 25);
					btnSalir.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent evt) {
							dispose();
						}
					});
				}
			}
			{
				jMenuBar1 = new JMenuBar();
				setJMenuBar(jMenuBar1);
				{

					jMenu1 = new JMenu();
					jMenuBar1.add(jMenu1);
					jMenu1.setText("ABM Clientes");
					if (this.usuarioBean.getPerfil() == "OFV") {
						{
							jMenuCliente = new JMenu();
							jMenu1.add(jMenuCliente);
							jMenuCliente.setText("Cliente");
							{
								jMenuItemAlta = new JMenuItem();
								jMenuCliente.add(jMenuItemAlta);
								jMenuItemAlta.setText("Alta");
								jMenuItemAlta
										.addActionListener(new ActionListener() {
											public void actionPerformed(
													ActionEvent evt) {
												JFrameAltaCliente altaCli = new JFrameAltaCliente();
												altaCli.setVisible(true);
												jDesktopPane1.add(altaCli);

											}
										});
							

							{
								jMenuItemBaja = new JMenuItem();
								jMenuCliente.add(jMenuItemBaja);
								jMenuItemBaja.setText("Baja");
								jMenuItemBaja
										.addActionListener(new ActionListener() {
											public void actionPerformed(
													ActionEvent evt) {
												JFrameBajaCliente bc = new JFrameBajaCliente();
												bc.setVisible(true);
												jDesktopPane1.add(bc);
											}
										});
							}
							{
								jMenuItemModificacion = new JMenuItem();
								jMenuCliente.add(jMenuItemModificacion);
								jMenuItemModificacion.setText("Modificacion");
								jMenuItemModificacion
										.addActionListener(new ActionListener() {
											public void actionPerformed(
													ActionEvent evt) {
												JFrameUpdateCliente mc = new JFrameUpdateCliente();
												mc.setVisible(true);
												jDesktopPane1.add(mc);
											}
										});
							}
						}
					}
					
					}
				}
				{
					jMenu3 = new JMenu();
					jMenu3.setVisible(false);
					jMenuBar1.add(jMenu3);
					jMenu3.setText("PruebasNegocio");
			

				}
			}
			// pack();
			// this.setSize(800, 600);
		} catch (Exception e) {
			// add your error handling code here
			e.printStackTrace();
		}
	}

	public UsuarioBean getBeanUsuario() {
		return usuarioBean;
	}

	public void setBeanUsuario(UsuarioBean usuarioBean) {
		this.usuarioBean = usuarioBean;
	}

}
